<?php
/**
 * @var $data Training
 */
$thumb = '';
if($data->image_id){
	$thumb = '/upload/images/thumb/'.substr_replace($data->image->path,'',0,14);
	if(!is_file(Yii::getPathOfAlias('webroot').$thumb)){
		Yii::import('application.extensions.image.Image');
		$image = new Image(Yii::getPathOfAlias('webroot').'/'.$data->image->path);
		$image->resize(130, 100);
		$image->save(Yii::getPathOfAlias('webroot').$thumb);
	}
}
?>
<div class="item">
    <?php if($data->image_id): ?><div class="img"><img src="<?php echo Yii::app()->baseUrl.$thumb; ?>"></div><?php endif?>
    <div class="title">
        <?php echo CHtml::link(CHtml::encode($data->title), $this->createUrl('view', array('id' => $data->id, 'title' => Yii::app()->func->safeTitle($data->title)))); ?>
    </div>
    <abbr class="date">Ngày đăng: <?php echo date('d/m/Y',$data->create_time); ?></abbr>
<!--    <div class="date">--><?php //echo date('d/m/Y',$data->create_time); ?><!--</div>-->
    <div class="body">
        <?php echo Yii::app()->func->limitWord($data->body,50);?>
    </div>
    <?php echo CHtml::link(CHtml::encode("Xem tiếp ⇒"), $this->createUrl('view', array('id' => $data->id, 'title' => Yii::app()->func->safeTitle($data->title))),array('class'=>'xem_tiep')); ?>
</div>